// ignore_for_file: prefer_const_constructors

import 'package:flutter/material.dart';
import 'package:get/get.dart';

import 'controller.dart';
import 'page_index2.dart';

class StateLazyPutView extends StatelessWidget {
  const StateLazyPutView({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text("依赖注入 - LazyPut"),
      ),
      body: Center(
        child: Column(
          children: <Widget>[
            SizedBox(height: 10,),
            GetX<LazyputController>(
              init: LazyputController(),
              initState: (_) {},
              builder: (_) => Text("value -> ${_.count}"),
            ),
            SizedBox(height: 10,),
            Divider(),
            SizedBox(height: 10,),
            ElevatedButton(
              onPressed: (){ 
                Get.find<LazyputController>().add();
              },
              child: Text("add",style: TextStyle(fontSize: 18))
            ),
            ElevatedButton(
              onPressed: (){ 
                Get.to(() => StateLazyPut2());
              },
              child: Text("下一个 GetView 页面",style: TextStyle(fontSize: 18))
            )
          ],
        ),
      ),
    );
  }
}